﻿using Dao.Corpus;
using ShareCode.Entity.Corpus;
using Infrastructure.Attributes.Ioc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShareCode.Dto.Corpus;
using ShareCode.Dto;
using ShareCode.Entity;

namespace Bll.Corpus
{
    /// <summary>
    /// by zhouxin
    ///</summary>
    [Component]
    public class CorpusAdornBll : BaseContainTitleBll<CorpusAdornEntity>
    {
        protected override CorpusAdornDao? Dao => (CorpusAdornDao?)base.Dao;

        [Autowired]
        public CorpusAdornDao SetDao { set { this._Dao = value; } }

        public async Task<PagingWithDataModel<CorpusAdornWithTypeDto>> ListPageWithTypeAsync(PagingDto? pars) {
            return await Dao!.ListPageWithTypeAsync(pars);
        }

        public async Task<List<CorpusAdornWithTypeDto>> ListWithTypeAsync(PagingDto? pars) {
            return await Dao!.ListWithTypeAsync(pars);
        }

        public async Task<PagingWithDataModel<CorpusAdornWithTypeDto>> ListPageWithTypeNoDeleteAsync(PagingDto? dto)
        {
            dto ??= new PagingDto();
            dto.SearchField.TryAdd(nameof(BaseBaseEntity.IsDelete), "0");

            return await Dao!.ListPageWithTypeAsync(dto);
        }

        public async Task<List<CorpusAdornWithTypeDto>> ListWithTypeNoDeleteAsync(PagingDto? dto)
        {
            dto ??= new PagingDto();
            dto.SearchField.TryAdd(nameof(BaseBaseEntity.IsDelete), "0");

            return await Dao!.ListWithTypeAsync(dto);
        }
    }
 }
